<span id="page_title">SCIS Info Board</span>
<nav id="nav">
    <ul id="menu">
        <?php 
            $link_value_public = array('Home', 'Programs',);
            $link_public_id = array('home_nav', 'programs_nav',);
            $link_href_public = array(site_url().'home', site_url().'program');
            
            $link_value_authenticated = array('Post', 'Groups', 'SCIS');
            $link_authenticated_id = array('bulletin_nav', 'groups_nav','scis_nav');
            $link_href_authenticated = array(site_url().'authenticated/posts', site_url().'authenticated/groups', site_url().'about');
            
            if(!$this->session->userdata('logged_in')) { 
                for($i = 0; $i<sizeof($link_value_public);$i++) {
                    echo '<li id=main_menu><a class=main_a href="'.$link_href_public[$i].'" id="'.$link_public_id[$i].'">'.$link_value_public[$i].'</a></li>';
                }
            } else {
                for($i = 0; $i<sizeof($link_value_authenticated);$i++) {
                    if($link_value_authenticated[$i] === 'SCIS') {
                        $temp0 = '<li>'.anchor(base_url().'about', 'About SCIS').'</li>';
                        $temp1 = '<li>'.anchor($link_href_public[1], $link_value_public[1]).'</li>';
                        //$temp2 = '<li>'.anchor($link_href_public[2], $link_value_public[2]).'</li>';
                        echo '<li id="main_menu first_sub_menu"><a class=main_a href='.$link_href_authenticated[$i].' id="'.$link_authenticated_id[$i].'">'.$link_value_authenticated[$i].'</a><ul>'.$temp0.$temp1.'<ul>'.'</li>';
                    } else {
                        echo '<li id=main_menu><a class=main_a href="'.$link_href_authenticated[$i].'" id="'.$link_authenticated_id[$i].'">'.$link_value_authenticated[$i].'</a></li>';
                    }
                }
            } 
        ?>
    </ul>
</nav>

<div id="user_menu">
  <?php 
      if(!$this->session->userdata('logged_in')) {
          echo "<div id=loginContainer>
                <a href=# id=loginButton><span>Login    </span><em></em></a>
                <div style=clear:both></div>
                <div id=loginBox>                
                    <form id=loginForm action=login/validate method=post>
                        <fieldset id=body>
                            <fieldset>
                                <label for=email>ID Number:</label>
                                <input type=text name=username id=username />
                            </fieldset>
                            <fieldset>
                                <label for=password>Password:</label>
                                <input type=password name=password id=password />
                            </fieldset>
                            <input type=submit id=login value='Log In'/>
                        </fieldset>
                    </form>
                </div>
            </div>";
      } else {
          echo '<span id="sideB"><a href="' . base_url() .'logout"><span>Logout</span></a></span>';
          if($this->session->userdata('role') === 'viewer') {
              echo '<span id="sideB"><a href="'.base_url().'authenticated/profile/'.$this->session->userdata('idno').'"><span>Profile</span></a></span>';
          }else if($this->session->userdata('role') === 'author'){
              echo '<span id="sideB"><a href="'.base_url().'authenticated/profile/'.$this->session->userdata('idno').'"><span id="profile_nav">Profile</span></a></span>';
              echo '<span id="sideB"><a href="' . base_url() . 'post"><span>Dashboard</span></a></span>';
          }else{
              echo '<span id="sideB"><a href="'.base_url().'authenticated/profile/'.$this->session->userdata('idno').'"><span id="profile_nav">Profile</span></a></span>';
              echo '<span id="sideB"><a href="' . base_url() . 'users"><span>Dashboard</span></a></span>';
          }
      }
  ?>
</div>
  
<div id="line"></div>
